package com.example.mooney.domain;

import com.example.mooney.domain.Expense;
import java.lang.Long;
import java.util.List;
import javax.persistence.EntityManager;

privileged aspect Expense_Roo_Entity {
    
    public static EntityManager Expense.entityManager() {    
        EntityManager em = new Expense().entityManager;        
        if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");        
        return em;        
    }    
    
    public static long Expense.countExpenses() {    
        return (Long) entityManager().createQuery("select count(o) from Expense o").getSingleResult();        
    }    
    
    public static List<Expense> Expense.findAllExpenses() {    
        return entityManager().createQuery("select o from Expense o").getResultList();        
    }    
    
    public static Expense Expense.findExpense(Long id) {    
        if (id == null) throw new IllegalArgumentException("An identifier is required to retrieve an instance of Expense");        
        return entityManager().find(Expense.class, id);        
    }    
    
    public static List<Expense> Expense.findExpenseEntries(int firstResult, int maxResults) {    
        return entityManager().createQuery("select o from Expense o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();        
    }    
    
}
